<%@ Page language="c#" Codebehind="CustomDiscount.aspx.cs" AutoEventWireup="false" Inherits="QuoteAdvantage.CustomDiscount" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
   <HEAD>
      <title>Custom Discount</title>
      <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
      <meta content="C#" name="CODE_LANGUAGE">
      <meta content="JavaScript" name="vs_defaultClientScript">
      <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
      <link href="QuoteAdvantageStyles.css" type="text/css" rel="stylesheet">
      <script language="javascript" type="text/javascript">
         function onFormLoaded()
         {
            document.Form1.txtPercentageDiscount.select();
            document.Form1.txtPercentageDiscount.focus();
         } 
         
         function onUpdateValuesClicked()
         {
            var bResult = true;
            
            if (document.Form1.txtPercentageDiscount.value != "")
            {
               if (!isValidNumber(document.Form1.txtPercentageDiscount.value))
               {
                  alert("Please enter a valid Percentage Discount");
                  document.Form1.txtPercentageDiscount.focus();
                  bResult = false;
               }
            }
            
            return bResult;  
         }   
         
         function isValidNumber(inpString) 
         {
            inpString = inpString.replace("$", "");
            inpString = inpString.replace("%", "");
            
            return /^[-+]?\d+(\.\d+)?$/.test(inpString);
         } 
         
         function onCancelClicked()
         {
            var bResult = true;
            
            if (document.Form1.txtInitialDiscount.value != document.Form1.txtPercentageDiscount.value
                  || document.Form1.txtInitialTargetPrice.value != document.Form1.txtTargetPrice.value)
            {
               bResult = confirm("Exit without saving changes?");
            }
            
            return bResult;
         }    
      </script>
   </HEAD>
   <body class="QuoteAdvantagePage" onload="onFormLoaded()" MS_POSITIONING="GridLayout">
      <form id="Form1" method="post" runat="server">
         <DIV class="Toolbar" style="Z-INDEX: 101; LEFT: 0px; WIDTH: 712px; POSITION: absolute; TOP: 0px; HEIGHT: 22px"
            ms_positioning="GridLayout">
            <asp:linkbutton id="lnkCancel" style="Z-INDEX: 103; LEFT: 608px; POSITION: absolute; TOP: 0px" runat="server"
               CssClass="ToolbarButton" Height="20px" Width="96px">Cancel</asp:linkbutton>
            <asp:linkbutton id="lnkSave" style="Z-INDEX: 112; LEFT: 504px; POSITION: absolute; TOP: 0px" runat="server"
               Width="96px" Height="20px" CssClass="ToolbarButton">Save</asp:linkbutton>
         </DIV>
         <asp:Label id="Label1" style="Z-INDEX: 109; LEFT: 408px; POSITION: absolute; TOP: 160px" runat="server"
            CssClass="Label">%</asp:Label>
         <asp:Label id="lblQuoteTotalValue" style="Z-INDEX: 108; LEFT: 324px; POSITION: absolute; TOP: 124px"
            runat="server" Width="88px" CssClass="Header" Font-Size="10pt">$1234.00</asp:Label>
         <asp:TextBox id="txtTargetPrice" style="Z-INDEX: 107; LEFT: 320px; POSITION: absolute; TOP: 184px"
            runat="server" Width="84px"></asp:TextBox>
         <asp:TextBox id="txtPercentageDiscount" style="Z-INDEX: 106; LEFT: 320px; POSITION: absolute; TOP: 152px"
            runat="server" Width="84px"></asp:TextBox>
         <asp:Label id="Label3" style="Z-INDEX: 104; LEFT: 256px; POSITION: absolute; TOP: 188px" runat="server"
            CssClass="Label">Target Price:</asp:Label>
         <asp:Label id="Label2" style="Z-INDEX: 103; LEFT: 216px; POSITION: absolute; TOP: 156px" runat="server"
            CssClass="Label">Percentage Discount:</asp:Label>
         <asp:Label id="lblQuoteTotal" style="Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 124px"
            runat="server" CssClass="Label">Quote Total:</asp:Label>
         <asp:Button id="btnUpdateValues" style="Z-INDEX: 105; LEFT: 420px; POSITION: absolute; TOP: 184px"
            runat="server" Text="Update Values" Width="100px"></asp:Button>
         <INPUT runat="server" style="Z-INDEX: 110; LEFT: 280px; POSITION: absolute; TOP: 320px"
            type="hidden" id="txtInitialDiscount"> <INPUT runat="server" style="Z-INDEX: 111; LEFT: 280px; POSITION: absolute; TOP: 348px"
            type="hidden" id="txtInitialTargetPrice"></form>
   </body>
</HTML>
